package cc.eddic.pratice.programmingparadigms.emp03objlist.impl;

import cc.eddic.pratice.programmingparadigms.Result;
import cc.eddic.pratice.programmingparadigms.ResultComparator;
import cc.eddic.pratice.programmingparadigms.emp02list.ResultList;
import cc.eddic.pratice.programmingparadigms.emp03objlist.ObjectComparator;
import cc.eddic.pratice.programmingparadigms.emp03objlist.ObjectList;
import cc.eddic.pratice.programmingparadigms.emp03objlist.ObjectPredicate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ResultListTyqImpl extends ObjectList {

    private static final Logger log = LoggerFactory.getLogger(ObjectList.class);
    private Result[] results;
    private int index;
    protected ResultListTyqImpl() {
        super();
    }

    protected ResultListTyqImpl(int capacity) {
        super(capacity);
    }

    @Override
    protected void add(Object obj) {
        super.add(obj);
    }

    @Override
    protected Result get(int index) {
        return (Result) super.get(index);
    }

    protected void sort(ResultComparator comparator) {
        super.sort(new ObjectComparator() {
            @Override
            public int compare(Object o1, Object o2) {
                return comparator.compare((Result) o1, (Result) o2);
            }
        });
    }

    @Override
    protected Object find(ObjectPredicate predicate) {
        return super.find(predicate);
    }
}
